<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>阶梯返利申请详情</title>
<jsp:include page="../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="Wrapper">
	<div id="pageInTab" class="pageInTab">
		<div tabid="tabA" title="基本信息" lselected="true">
            <form id="formSet1">
            	<div class="fieldset1 tabel_col clearFix">
            		<div class="caption">
                        <span class="title">基础信息</span>
                    </div>
                    <div class="fieldBox col_50">
	                    <div class="label">返利金额合计</div>
	                    <div class="field">
							<input name="stepRebateAmt" id="stepRebateAmt" type="text"  value="<fmt:formatNumber value='${prjStepRebateFeeVO.stepRebateAmt}' pattern='0.00' />" disabled="true">
	                    </div>
	                </div>
					<div class="fieldBox col_50">
						<div class="label">账户名</div>
						<div class="field">
							<input name="rcptUnt" id="rcptUnt" type="text"  value="${prjStepRebateFeeVO.rcptUnt}" disabled="true">
						</div>
					</div>
                    <div class="fieldBox col_50">
	                    <div class="label">开户行及支行</div>
	                    <div class="field">
							<input name="bkNm" id="bkNm" type="text"  value="${prjStepRebateFeeVO.bkNm}" disabled="true">
	                    </div>
	                </div>
                    <div class="fieldBox col_50">
	                    <div class="label">开户行账号</div>
	                    <div class="field">
							<select  name="accNo" id="accNo" ligerui="width: 140"  style="width:160px" <c:if test="${isDetail == '1' }">disabled="true"</c:if>>
								<option value="" >请选择</option>
								<c:forEach items="${splBankVOS }" var="kv">
									<option value="${kv.accNo }" <c:if test="${kv.accNo == prjStepRebateFeeVO.accNo }">selected</c:if>>${kv.accNo }</option>
								</c:forEach>
							</select>
	                    </div>
	                </div>
					<div class="fieldBox col_50">
						<div class="label">开户行行号</div>
						<div class="field">
							<input name="bkNo" id="bkNo" type="text"  value="${prjStepRebateFeeVO.bkNo}" disabled="true">
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">经销商</div>
						<div class="field">
							<input name="splNm" id="splNm" type="text"  value="${prjStepRebateFeeVO.splNm}" disabled="true">
						</div>
					</div>
            	</div>
				<c:if test="${isDetail == '2' }">
				<div class="btnsBox">
					<span id="saveBtn1" class="sq-button sq-button-round">保存</span>
					<input name="id" id="id" type="hidden" value="${prjStepRebateFeeVO.id }">
					<input name="splId" id="splId" type="hidden" value="${prjStepRebateFeeVO.splId }">
				</div>
				</c:if>
				<div class="fieldBox col_100">
					<div style="width: 100%; ">
						<table style="BORDER-COLLAPSE: collapse;margin-bottom:20px" borderColor=#ECECEC height=40 cellPadding=1 width="100%" align=center border=1>
							<thead>
							<tr style="background:#E7FEF4">
								<th  style="text-align: center;width:5%;"></th>
								<th  style="text-align: center;width:10%">支付表号</th>
								<th  style="text-align: center;width:10%">供应商返利金额</th>
								<th  style="text-align: center;width:10%">GPS返利金额</th>
								<th  style="text-align: center;width:6%">销售返利金额</th>
								<th  style="text-align: center;width:6%">供应商阶梯返利</th>

								<th  style="text-align: center;width:8%">起租日</th>
								<th  style="text-align: center;width:6%">项目类型</th>
								<th  style="text-align: center;width:8%">所属事业部</th>
								<th  style="text-align: center;width:9%">资管机构</th>
							</tr>
							</thead>
							<tbody>
							<c:forEach items="${prjStepRebateFeeDetailVOs}" var="item" varStatus="status">
								<tr>
									<td  style="text-align: center; height:20px;">${status.index+1}</td>
									<td style="text-align: center; ">${item.paySchNo }</td>
									<td style="text-align: center; "><fmt:formatNumber value='${item.splBackAmt }' pattern='0.00' /></td>
									<td style="text-align: center; "><fmt:formatNumber value='${item.gpsBackAmt }' pattern='0.00' /></td>
									<td style="text-align: center; "><fmt:formatNumber value='${item.salBackAmt }' pattern='0.00' /></td>
									<td  style="text-align: center;"><fmt:formatNumber value='${item.stepRebateAmt }' pattern='0.00' /></td>
									<td  style="text-align: center;"><fmt:formatDate type="date" value="${item.lsDt }"/></td>
									<td style="text-align: center; ">${item.prjTypCdNm }</td>
									<td style="text-align: center; ">${item.buOrgCdNm }</td>
									<td style="text-align: center; ">${item.insCode }</td>
								</tr>
							</c:forEach>
							</tbody>
						</table>
					</div>
				</div>
                
            </form>
        </div>
	</div>
</div>
</div>


<script type="text/javascript">
	var isDetail = '${isDetail}';
	var splBankJsons = '${splBankJsons}';
	var prjStepRebateFeeVO = '${prjStepRebateFeeVO}';
	$("#accNo").change(function(){
		var splBanks = JSON.parse(splBankJsons);
		var value = $("#accNo").val();
		console.log(value);
		for(var i=0;i<splBanks.length;i++){
			var splBank = splBanks[i];
			if(splBank.accNo ==  value){
				$('#accNo').val(splBank.accNo);
				$('#rcptUnt').val(splBank.rcptUnt);
				$('#bkNm').val(splBank.bkNm);
				$('#bkNo').val(splBank.bkNo);
			}
		}
	})

	$("#saveBtn1").click(function(event) {
		var form = new liger.get("formSet1");
		var data = {};
		var url='<%=path%>/prjsteprebate/steprebateBscInfo/modify.do';

		data["id"] = $('#id').val();//机构id
		data["rcptUnt"] = $('#rcptUnt').val();//账户名
		data["bkNm"] = $('#bkNm').val();//开户行及支行
		data["accNo"] = $('#accNo').val();//开户行账号
		data["bkNo"] = $('#bkNo').val();//开户行号

		var wait_dialog;
		$.ajax({
			type: 'post',
			dataType:'json',
			data:data,
			url: url,
			beforeSend: function(){
				wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
			},
			success:function(msg){
				wait_dialog.close();
				if(msg.success == 1){
					$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
					frameElement.dialog.close();
				}else{
					$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				}
			}
		})
	})
</script>



</body>
</html>
